home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 7025 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: xs4all.nl!not-for-mail
  2. From: yrozijn@xs4all.nl (Yvon Rozijn)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: AmiTCP and threads
  5. Date: 7 Apr 1996 17:33:45 GMT
  6. Organization: XS4ALL, networking for the masses
  7. Message-ID: <4k8u9p$2pa@news.xs4all.nl>
  8. References: <9604061820.AA00093@entire.demon.co.uk>
  9. NNTP-Posting-Host: asd01-29.dial.xs4all.nl
  10. X-Newsreader: TIN [AMIGA 1.3 950726BETA PL0]
  11.  
  12. Mike Gooder (mike@entire.demon.co.uk) wrote:
  13.  
  14. : times with CreateNewProcTags(). Since AmiTCP will not allow the 
  15. : sharing of SocketBase between tasks, each time this function is
  16. : started as a thread it needs it's own SocketBase.
  17. : Is there a way of doing this or am i going about this the wrong 
  18. : way ?
  19.  
  20. void __saveds yourprocess(void)
  21. {  struct Library *SocketBase;
  22.    ...
  23.    if(SocketBase=OpenLibrary("bsdsocket.library",0))
  24.    {  ...
  25.       /* do your TCP stuff here */
  26.       somefunction(SocketBase,...)  /* if you need to call other functions */
  27.       ...
  28.       CloseLibrary(SocketBase);
  29.    }
  30. }
  31.  
  32. void somefunction(struct Library *SocketBase,...)
  33. {  ...
  34. }
  35.  
  36. In this way the library base pointer is allocated on the stack and passed
  37. through to other functions. Since the AmiTCP header file uses #pragma
  38. libcall to define the library entry points, this will work fine.
  39.  
  40. -- 
  41.                  ___                                   _
  42.    Q          : |  #|           :  \|/  http://www. : [_]_
  43.  -<_>- Yvon   : | ==| yrozijn@  : >WWW< xs4all.nl/  : === ) Amiga
  44.   / \  Rozijn : `---' xs4all.nl :  /|\  ~yrozijn    :     O  4000
  45.